/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package negocio;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Dvid
 */
@Entity
@Table(name = "emp_accid")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmpAccid.findAll", query = "SELECT e FROM EmpAccid e"),
    @NamedQuery(name = "EmpAccid.findByEmpid", query = "SELECT e FROM EmpAccid e WHERE e.empAccidPK.empid = :empid"),
    @NamedQuery(name = "EmpAccid.findByAccidenteid", query = "SELECT e FROM EmpAccid e WHERE e.empAccidPK.accidenteid = :accidenteid")})
public class EmpAccid implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected EmpAccidPK empAccidPK;

    public EmpAccid() {
    }

    public EmpAccid(EmpAccidPK empAccidPK) {
        this.empAccidPK = empAccidPK;
    }

    public EmpAccid(String empid, int accidenteid) {
        this.empAccidPK = new EmpAccidPK(empid, accidenteid);
    }

    public EmpAccidPK getEmpAccidPK() {
        return empAccidPK;
    }

    public void setEmpAccidPK(EmpAccidPK empAccidPK) {
        this.empAccidPK = empAccidPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (empAccidPK != null ? empAccidPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmpAccid)) {
            return false;
        }
        EmpAccid other = (EmpAccid) object;
        if ((this.empAccidPK == null && other.empAccidPK != null) || (this.empAccidPK != null && !this.empAccidPK.equals(other.empAccidPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "negocio.EmpAccid[ empAccidPK=" + empAccidPK + " ]";
    }
    
}
